import indexVue from "../views/index.vue";
import VueRouter from "vue-router";
import Vue from "vue";
import loginVue from "../views/login.vue";
import productVue from "../views/product.vue";

Vue.use(VueRouter);

const routes = [
  {
    path: "/product",
    component: indexVue,
    children: [
      {
        path: "", // 这里使用空字符串表示默认子路由，访问 /product 时会加载 productVue 组件
        component: productVue
      }
    ]
  },
  {
    path: "/",
    component: loginVue
  },
  {
    path: "/indexVue", // 修正路径大小写与组件名一致
    component: indexVue
  }
];

const router = new VueRouter({
  routes,
  mode: "history"
});

export default router;